package vip.xiaonuo.sys.fymodule.account.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import vip.xiaonuo.sys.fymodule.account.entity.SxoSafetyCardBinding;
import vip.xiaonuo.sys.fymodule.account.mapper.SxoSafetyCardBindingMapper;
import vip.xiaonuo.sys.fymodule.account.service.ISxoSafetyCardBindingService;

import java.util.List;


/**
 * 银行卡绑定业务信息表 业务层实现
 *
 * @author wangy
 * @since 2025-06-14
 */
@Slf4j
@Service
public class SxoSafetyCardBindingServiceImpl extends ServiceImpl<SxoSafetyCardBindingMapper, SxoSafetyCardBinding> implements ISxoSafetyCardBindingService {


    @Override
    public SxoSafetyCardBinding findCard(String userId, String source) {
        LambdaQueryWrapper<SxoSafetyCardBinding> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SxoSafetyCardBinding::getSource,source);
        queryWrapper.eq(SxoSafetyCardBinding::getUserId,userId);
        queryWrapper.eq(SxoSafetyCardBinding::getStatus,"0");
        List<SxoSafetyCardBinding> list = this.list(queryWrapper);
        if(!list.isEmpty()){
            return list.get(0);
        }
        return null;
    }
}